<extend name="Base/user"/>

<block name="breadcrumb">
  <ul class="breadcrumb">
    <li><a href="{:U('/')}">首页</a></li>
    <li><a href="{:U('Join/joinOrder')}">拼团</a></li>
    <li class="active">拼团订单详情</li>
  </ul>
</block>

<block name="body">
  <div class="user-box">
    <h3>拼团订单详情</h3>
    
    <div class="box-bd">
      <div class="order-detail-tables">
        <table class="order-detail-table">
          <thead>
            <tr>
              <th class="column-info" colspan="7">
                <div class="column-content">
                  订单号：{$data.join_sn}
                  <span class="sep">|</span>
                  下单时间：{$data['ctime']|time_format}
                  <i class="pull-right color-999">
                    合计： 1个包裹 {$data['total_quantity']} 件商品
                  </i>
                </div>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td class="column-detail">
                <ul class="order-goods-list">
                  
                    <li class="first">
                      <a href="{:U('Item/detail', array('id' => $data['item_id']))}" class="pic" target="_blank"><img src="__ROOT__{:get_cover($data['thumb'],'path')}" width="60" class="goods-thumb" alt="{$data.item_name}"></a>
                      <span class="color-999">{:custom_unserialize($data['spec'], 1, '，')}</span>
                    </li>
                </ul>
              </td>
              <td width="100" class="text-center">
                <span class="text-danger">&yen; {$data.price}</span>
              </td>
              <td width="100" class="text-center color-999">
                <i class="icon icon-close"></i> {$data.total_quantity}
              </td>
            
              <td class="column-action" rowspan="1">
                <!-- <em class="msg">{$data.status|get_order_status_text}</em> -->
                <div class="text-center order-info order-action">
                  <switch name="data.status">
                    <case value="-1">
                      <a href="javascript:;" class="btn btn-positive">订单支付失败</a>
                    </case>
                    <case value="1">
                      <a href="javascript:;" class="msg"><eq name="data.j_status" value="1">拼团成功<else />支付成功，待拼团</eq></a>
                    </case>
                    <case value="0">
                        <a href="{:U('Join/preview', array('order_sn' => $data['join_sn']))}" class="btn btn-sm btn-positive"><i class="icon icon-recharge"></i> 立即支付</a>
                    </case>
                    <case value="2">
                        <a href="javascript:;" class="msg"><eq name="data.j_status" value="2">拼单失败,退款处理中<else />拼团失败且已退款</eq></a>
                    </case>
                  </switch>
                </div>
              </td>
            </tr>
            
            
            <tr>
              <td class="column-delivery" colspan="7">
                <div class="order-delivery-status">
                  <ol class="order-delivery-steps clearfix">
                    <li class="step step-first step-now">
                      <div class="progress">
                        <span class="text">下单</span>
                      </div>
                      <div class="info">{$data.create_time|time_format}</div>
                    </li>
                    <li class="step <gt name="data.status" value="0"> step-now </gt> ">
                      <div class="progress"><span class="text">付款</span></div>
                      <gt name="data.status" value="0"><div class="info">{$data.paytime|time_format}</div></gt>
                    </li>
                    <switch name="data.j_status">
                      <case value="2">
                       <li class="step step-last step-now">
                          <div class="progress"><span class="text">拼单失败,退款处理中</span></div>
                        </li>
                      </case>
                      <case value="3">
                        <li class="step step-last step-now">
                          <div class="progress"><span class="text">拼团失败且已退款</span></div>
                        </li>
                      </case>
                    </switch>
                    <lt name="data.j_status" value="2">
                      <li class="step step-last <eq name="data.j_status" value="1">step-now</eq>">
                        <div class="progress"><span class="text">拼团成功</span></div>
                        <eq name="data.j_status" value="1"><div class="info">{$data.complete_time|time_format}</div></eq>
                      </li>
                    </lt>
                  </ol>
                </div>
              </td>
            </tr>
            
            
          </tbody>
        </table>
      </div>
      <div class="order-detail-total clearfix">
        <gt name="data.Ship.id" value="0">
          <dl class="delivery-info">
            <dd>快递公司：{$data.Ship.delivery_name}</dd>
            <dd>快递单号：{$data.Ship.delivery_sn}</dd>
            <dd class="delivery-log hide J_delivery_log"></dd>
          </dl>
        </gt>
        <dl class="total-list">
          <dt>商品总价：</dt>
          <dd>&yen; {$data.total_price}</dd>
          <dt>+ 运费总额：</dt>
          <dd>&yen; {$data.delivery_fee|default=0}</dd>
          
          <if condition="$data['paytime'] gt 0">
            <dt>实际支付：</dt>
            <dd class="text-price">{:sprintf('%.2f', $data['total_amount'])}</dd>
            <else />
            <dt>还需支付金额：</dt>
            <dd class="text-price">{:sprintf('%.2f', $data['total_amount'])}</dd>
          </if>
        </dl>
      </div>
    </div>

    <div class="order-delivery-address">
      <div id="changeAddress" class="order-text-section">
        <h4>收货信息 </h4>
        <table class="order-text-table">
          <tbody>
            <tr>
              <th>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</th>
              <td>{$data.ship_uname}</td>
            </tr>
            <tr>
              <th>联系电话：</th>
              <td>{$data.ship_mobile}</td>
            </tr>
            <tr>
              <th>收货地址：</th>
              <td>{$data.ship_area}, {$data.ship_address}</td>
            </tr>
          </tbody>
        </table>
        
        <notempty name='data.memo'>
        <h4>订单备注 </h4>
        <table class="order-text-table">
          <tbody>
              <tr>
              <th>备注：</th>
              <td>{$data.memo}</td>
            </tr>
          </tbody>
        </table>
        </notempty>
      </div>   
      <div class="order-text-section"></div>
    </div>
  </div>
</block>
<block name="script">
  <script>
    var order, comment;
    seajs.use(['order', 'comment', 'delivery'], function(o, c, delivery){
      order = o;
      comment = c;
      delivery.getDeliveryInfo("{$data.Ship.delivery_name}", "{$data.Ship.delivery_sn}");
    });
  </script>
</block>